package cn.com.lyj6851.modules.edu.controller;


import cn.com.lyj6851.api.ApiResult;
import cn.com.lyj6851.modules.edu.service.EduCommentService;
import cn.com.lyj6851.modules.edu.vo.CommentVo;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Administrator
 */
@Slf4j
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Api(value = "课程评论", tags = "网校:课程评论")
public class EduCommentController {

    private final EduCommentService eduCommentService;

    /**
     * 根据课程id获取评论
     */
    @GetMapping("comment/list")
    public ApiResult<CommentVo> getCommentListByCourseId(@RequestParam String courseId,
                                                         @RequestParam(value = "type", defaultValue = "0") int type,
                                                         @RequestParam(value = "page",defaultValue = "1") int page,
                                                         @RequestParam(value = "limit",defaultValue = "10") int limit){

        return ApiResult.ok(eduCommentService.getCommentListByCourseId(courseId,page,limit));
    }
}
